package com.gongj.shej.demo;

import com.gongj.shej.utils.SpringUtil;
import com.gongj.shej.策略模式.Strategy;
import com.gongj.shej.策略模式.StrategyEnum;

/**
 * @program: shej
 * @description:
 * @author: gongj
 * @Description: TODO
 * @create: 2020-07-23 20:08
 **/
public class FoodStrategyFactory {
    public static Strategy getFoodStrategy(Integer money){
        StrategyEnum strategyEnum = StrategyEnum.findStrategyEnum(money);
        if(strategyEnum == null){
            return null;
        }
        return SpringUtil.getBean(strategyEnum.getBeanName(), Strategy.class);
    }
}
